<template>
  <div id="app"> 
    <button @click="showOrNot">显示与隐藏</button>
    <h1 v-if="isShow">hello world</h1>
    <h1 v-show="isShow">hello world</h1>
    <ul>
      <li v-for="(fruit,index) of fruits" :key="index">
        <p>名称：{{fruit}}</p>
        <p>索引：{{index}}</p>
      </li>
    </ul>
    <table>
      <thead>
        <th>序号</th>
        <th>姓名</th>
        <th>年龄</th>
      </thead>
      <tbody>
        <tr v-for="(student,index) of students" :key="index">
          <td>{{index + 1}}</td>
          <td>{{student.name}}</td>
          <td>{{student.age}}</td>
        </tr>
      </tbody>
    </table>
    <Header></Header>
    <MenuList></MenuList>
    <menu-list></menu-list>
  </div>
</template>

<script>
  import Header from "./components/Header.vue"
  import MenuList from "./components/MenuList.vue"
  // import HelloWord from "@/components/Word"
  export default{
    components : {
      Header,
      MenuList
    },
    data(){
      return {
        isShow : true,
        fruits : ["香蕉","苹果","鸭梨"],
        students : [
          {name : "小明" , age : "19"},
          {name : "小刚" , age : "19"},
          {name : "小李" , age : "19"}
        ]
    }
    },
    methods : {
      showOrNot(){
        this.isShow = !this.isShow
      }
    }
  }
</script>

<style>

</style>